<?php
/**
 * <i>left</i>定义
 * 
 * @version $Id: IMintLeftModifier.php 312 2008-04-23 16:29:38Z iwind $
 * @package util.mint.modifier
 * @since 0.0.2
 */
class IMintLeftModifier extends IAbstractMintModifier {
	/**
	 * 构造器
	 *
	 */	
	public function __construct() {
		
	}
	
	/**
	 * 执行
	 *
	 * @return scalar
	 */	
	public function execute(/** string length multi etc  **/) {
		$string = $this->getVariable();
		$arguments = $this->getArguments();
		$length = isset($arguments[0])?intval($arguments[0]):0;
		if ($length <= 0) {
			return $string;
		}
		$multi = isset($arguments[1])?$arguments[1]:false;
		$etc = isset($arguments[2])?$arguments[2]:"";		
		$left = IStringHelper::left($string, $length, $multi);
		if (strlen($left) != strlen($string)) {
			return $left . $etc;
		}
		return $left;
	}
}

?>